//
// Created by 刘禹晨 on 16/5/25.
// Copyright (c) 2016 刘禹晨. All rights reserved.
//

//
// Created by 刘禹晨 on 16/3/16.
// Copyright (c) 2016 刘禹晨. All rights reserved.
//

#import "MyTabbar.h"
#import "UIViewExtension.h"

@interface MyTabbar()

@property (nonatomic, strong) UIButton *plusButton;

@end


@implementation MyTabbar

//
//- (instancetype)initWithFrame:(CGRect)frame {
//    self = [super initWithFrame:frame];
//    if (self) {
//        _plusButton = [[UIButton alloc]init];
//        //[_plusButton setBackgroundImage:[UIImage imageNamed:@"plus_big"] forState:UIControlStateNormal];
//        //[_plusButton setBackgroundImage:[UIImage imageNamed:@"plus_big"] forState:UIControlStateHighlighted];
//        //[_plusButton setBackgroundColor:[[UIColor new] initWithRed:45.0f / 255.0f green:133.0f / 255.0f blue:215.0f / 255.0f alpha:1.0f]];
//
//        [_plusButton setImage:[UIImage imageNamed:@"plus-circle"] forState:UIControlStateNormal];
//        [_plusButton setImage:[UIImage imageNamed:@"plus-circle"] forState:UIControlStateHighlighted];
//        //self.plusButton.size.height = 64;
//        //self.plusButton.size.width = 64;
//        //self.plusButton.size = _plusButton.currentBackgroundImage.size;
//        self.plusButton.size = CGSizeMake(44, 40);
//        [_plusButton addTarget:self action:@selector(plusClick) forControlEvents:UIControlEventTouchUpInside];
//        [self addSubview:_plusButton];
//    }
//
//    return self;
//}
//
//
//- (void)layoutSubviews
//{
//    [super layoutSubviews];
//
//    // 1.设置加号按钮的位置
//    self.plusButton.centerX = self.width * 0.5;
//    self.plusButton.centerY = self.height * 0.5;
//
//    // 2.设置其它UITabBarButton的位置和尺寸
//    CGFloat tabbarButtonW = self.width / 5;
//    CGFloat tabbarButtonIndex = 0;
//    for (UIView *child in self.subviews) {
//        Class class = NSClassFromString(@"UITabBarButton");
//        if ([child isKindOfClass:class]) {
//            // 设置宽度
//            child.width = tabbarButtonW;
//            // 设置x
//            child.x = tabbarButtonIndex * tabbarButtonW ;
//
//            // 增加索引
//            tabbarButtonIndex++;
//            if (tabbarButtonIndex == 2) {
//                tabbarButtonIndex++;
//            }
//        }
//    }
//}
//
//- (void)plusClick
//{
//    // 通知代理
//    if ([self.tabBarDelegate respondsToSelector:@selector(tabBarDidClickPlusButton:)]) {
//        [self.tabBarDelegate tabBarDidClickPlusButton:self];
//    }
//}

@end